$(function() {
	var token = localStorage.getItem('token');
	//console.log(token);
	//alert('11')
	$.ajax({
		url: C.interface.peronalInter,
		type: 'get',
		dataType: 'json',
		data: {
			token: token,
			appId:'gzh'
		},
		success: function(data) {
			console.log(data);
			if(data.code == "10000") {
				
				if(data.data == "") {
					editMain()					
				} else {
					var json = data.data;
					$("#uesrname").val(json.accountName);
					$("#jdtext").val(json.jdlmId);
					$("#protext").val(json.positionId);
					$("#qqtext").val(json.qqAccount);
					$("#teamtext").val(json.groupDesc);
					$("#teamname").val(json.groupName);
					$(".uploader-list").html('<div id="imgurl" class="file-item thumbnail">' +
                    '<img src="'+json.headImg+'">' +'</div>')
					$("input[name='inlineRadioOptions'][value="+json.type+"]").attr("checked",true); //根据Value值设置Radio为选中状态
				}
			} else {
				window.location.href = "login.html"
			}
		}
	})
	//提交按钮
	$("#submitBut").click(function() {
		
		var img = $("#imgurl").attr('img');
		//账户名称
		var username = $("#uesrname").val();
		//账户类型
		var usertype = $("input[name='inlineRadioOptions']:checked").val();
		//团队名称
		var teamname = $("#teamname").val();
		//京东联盟id
		var jstext = $("#jdtext").val();
		//推广位id
		var proid = $("#protext").val();
		//qq账户
		var qqnum = $("#qqtext").val();
		//团队介绍
		var teamtext = $("#teamtext").val();
		console.log(username, usertype, teamname, jstext, proid, qqnum, teamtext);
		$.ajax({
			url: C.interface.editperInter,
			type: 'get',
			dataType: 'json',
			data: {
				token:token,
				type:usertype,
				groupName:teamname,
				accountName:username,
				jdlmId:jstext,
				positionId:proid,
				qqAccount:qqnum,
				groupDesc:teamtext,
				headImg:img,
				appId:'gzh'
			},
			success: function(data) {
				if(data.code == "10000") {
					//console.log(data)\
					alert("提交成功")
				} else {
					
				}
			}
		})
		//location.reload();
		 window.location.reload();
	})
})